```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>MySQL深分页优化指南 | Java技术小馆</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            line-height: 1.8;
            color: #333;
        }
        h1, h2, h3, h4, h5, h6 {
            font-family: 'Noto Serif SC', serif;
            font-weight: 600;
            color: #222;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .code-block {
            background-color: #2d2d2d;
            border-radius: 8px;
            position: relative;
        }
        .code-header {
            background-color: #1e1e1e;
            border-top-left-radius: 8px;
            border-top-right-radius: 8px;
            padding: 8px 16px;
            color: #9e9e9e;
            font-family: monospace;
            display: flex;
            justify-content: space-between;
        }
        .code-copy {
            cursor: pointer;
            transition: all 0.3s;
        }
        .code-copy:hover {
            color: #fff;
        }
        .highlight {
            position: relative;
        }
        .highlight::after {
            content: '';
            position: absolute;
            left: 0;
            bottom: 2px;
            width: 100%;
            height: 8px;
            background-color: rgba(118, 75, 162, 0.3);
            z-index: -1;
            transition: all 0.3s;
        }
        .highlight:hover::after {
            height: 14px;
            background-color: rgba(118, 75, 162, 0.5);
        }
        .card-hover {
            transition: all 0.3s;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
        }
        .card-hover:hover {
            transform: translateY(-4px);
            box-shadow: 0 16px 24px rgba(0, 0, 0, 0.1);
        }
        .table-hover tbody tr:hover {
            background-color: rgba(102, 126, 234, 0.05);
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 md:py-32 px-4">
        <div class="max-w-5xl mx-auto">
            <div class="flex flex-col md:flex-row items-center">
                <div class="md:w-1/2 mb-10 md:mb-0">
                    <span class="inline-block px-3 py-1 bg-white bg-opacity-20 rounded-full text-sm mb-4">数据库优化技术</span>
                    <h1 class="text-4xl md:text-5xl font-bold leading-tight mb-6">MySQL深分页优化指南</h1>
                    <p class="text-xl opacity-90 mb-8">从12秒到150毫秒的性能飞跃，揭秘电商大厂都在用的分页优化技巧</p>
                    <div class="flex space-x-4">
                        <a href="#solutions" class="bg-white text-indigo-800 px-6 py-3 rounded-lg font-medium hover:bg-opacity-90 transition-all">
                            <i class="fas fa-bolt mr-2"></i>查看解决方案
                        </a>
                        <a href="#why-slow" class="border border-white border-opacity-30 text-white px-6 py-3 rounded-lg font-medium hover:bg-white hover:bg-opacity-10 transition-all">
                            <i class="fas fa-search mr-2"></i>原理分析
                        </a>
                    </div>
                </div>
                <div class="md:w-1/2 pl-0 md:pl-12">
                    <div class="bg-white bg-opacity-20 p-6 rounded-xl backdrop-blur-sm border border-white border-opacity-20">
                        <h3 class="text-xl font-bold mb-4 flex items-center">
                            <i class="fas fa-clock mr-2"></i>性能对比
                        </h3>
                        <div class="space-y-4">
                            <div>
                                <div class="flex justify-between text-sm mb-1">
                                    <span>传统分页</span>
                                    <span class="font-mono">8.2秒</span>
                                </div>
                                <div class="h-3 bg-white bg-opacity-30 rounded-full overflow-hidden">
                                    <div class="h-full bg-red-400 rounded-full" style="width: 100%"></div>
                                </div>
                            </div>
                            <div>
                                <div class="flex justify-between text-sm mb-1">
                                    <span>优化方案</span>
                                    <span class="font-mono">150毫秒</span>
                                </div>
                                <div class="h-3 bg-white bg-opacity-30 rounded-full overflow-hidden">
                                    <div class="h-full bg-green-400 rounded-full" style="width: 2%"></div>
                                </div>
                            </div>
                        </div>
                        <div class="mt-6 pt-6 border-t border-white border-opacity-20">
                            <h4 class="font-bold mb-2 flex items-center">
                                <i class="fas fa-lightbulb mr-2"></i>核心策略
                            </h4>
                            <ul class="space-y-2">
                                <li class="flex items-start">
                                    <i class="fas fa-angle-right mt-1 mr-2 text-xs opacity-70"></i>
                                    <span>游标分页黑科技（Twitter同款）</span>
                                </li>
                                <li class="flex items-start">
                                    <i class="fas fa-angle-right mt-1 mr-2 text-xs opacity-70"></i>
                                    <span>延迟关联骚操作（性能提升40倍）</span>
                                </li>
                                <li class="flex items-start">
                                    <i class="fas fa-angle-right mt-1 mr-2 text-xs opacity-70"></i>
                                    <span>业务妥协的艺术（学淘宝限制页数）</span>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Problem Section -->
    <section class="py-16 px-4 bg-white">
        <div class="max-w-5xl mx-auto">
            <div class="text-center mb-16">
                <span class="inline-block px-4 py-1 bg-indigo-100 text-indigo-800 rounded-full text-sm font-medium mb-4">问题分析</span>
                <h2 class="text-3xl font-bold mb-4">深分页为什么慢？原理比你想的更恐怖</h2>
                <p class="text-gray-600 max-w-3xl mx-auto">当用户翻到第50页时，你的接口是不是也开始装死？别怪MySQL慢 — <code class="bg-gray-100 px-1 py-0.5 rounded">LIMIT 1000000, 20</code> 这种写法，相当于让数据库把前100万条数据全嚼一遍再吐出来！</p>
            </div>

            <div class="grid md:grid-cols-2 gap-8 mb-16">
                <div>
                    <div class="code-block mb-8">
                        <div class="code-header">
                            <span>SQL 示例</span>
                            <span class="code-copy"><i class="far fa-copy"></i> 复制</span>
                        </div>
                        <pre class="overflow-x-auto p-4 text-gray-200"><code>-- 创建测试表
CREATE TABLE order_history (
    id BIGINT PRIMARY KEY AUTO_INCREMENT,
    user_id INT NOT NULL,
    amount DECIMAL(10,2),
    created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
    INDEX idx_user_id (user_id)
) ENGINE=InnoDB;

-- 执行分页查询
SELECT * FROM order_history 
WHERE user_id = 123 
ORDER BY created_at DESC 
LIMIT 1000000, 20; -- 耗时8.2秒</code></pre>
                    </div>
                </div>
                <div>
                    <h3 class="text-2xl font-bold mb-4">执行流程拆解</h3>
                    <ol class="list-decimal pl-5 space-y-3 text-gray-700">
                        <li>通过二级索引找到所有user_id=123的记录（假设10万条）</li>
                        <li>回表查询主键获取完整数据</li>
                        <li>对所有结果进行排序（即使只需要最后20条）</li>
                        <li>丢弃前100万条数据</li>
                        <li>返回最后20条</li>
                    </ol>
                    <div class="mt-6 p-4 bg-yellow-50 border-l-4 border-yellow-400">
                        <p class="text-yellow-800 flex items-start">
                            <i class="fas fa-exclamation-triangle mr-2 mt-1"></i>
                            <span>这就好比让你从图书馆找到100本书，但必须把前99万本都摸一遍才能拿最后10本！</span>
                        </p>
                    </div>
                </div>
            </div>

            <div class="mb-16">
                <h3 class="text-2xl font-bold mb-6 text-center">传统分页的四大死穴</h3>
                <div class="grid md:grid-cols-2 lg:grid-cols-4 gap-6">
                    <div class="card-hover bg-white p-6 rounded-xl border border-gray-200">
                        <div class="text-indigo-600 mb-4 text-2xl">
                            <i class="fas fa-database"></i>
                        </div>
                        <h4 class="font-bold mb-2">回表查询陷阱</h4>
                        <p class="text-gray-600">二级索引不包含全部列，必须回主键索引查数据</p>
                    </div>
                    <div class="card-hover bg-white p-6 rounded-xl border border-gray-200">
                        <div class="text-indigo-600 mb-4 text-2xl">
                            <i class="fas fa-sort-amount-down"></i>
                        </div>
                        <h4 class="font-bold mb-2">排序黑洞</h4>
                        <p class="text-gray-600">即使只需要最后几条，也必须对所有中间结果排序</p>
                    </div>
                    <div class="card-hover bg-white p-6 rounded-xl border border-gray-200">
                        <div class="text-indigo-600 mb-4 text-2xl">
                            <i class="fas fa-hdd"></i>
                        </div>
                        <h4 class="font-bold mb-2">无效IO风暴</h4>
                        <p class="text-gray-600">需要读取大量无用数据页到内存</p>
                    </div>
                    <div class="card-hover bg-white p-6 rounded-xl border border-gray-200">
                        <div class="text-indigo-600 mb-4 text-2xl">
                            <i class="fas fa-unlink"></i>
                        </div>
                        <h4 class="font-bold mb-2">索引失效危机</h4>
                        <p class="text-gray-600">复杂排序条件可能导致索引失效</p>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Solutions Section -->
    <section id="solutions" class="py-16 px-4 bg-gray-50">
        <div class="max-w-5xl mx-auto">
            <div class="text-center mb-16">
                <span class="inline-block px-4 py-1 bg-indigo-100 text-indigo-800 rounded-full text-sm font-medium mb-4">解决方案</span>
                <h2 class="text-3xl font-bold mb-4">三大优化方案实战</h2>
                <p class="text-gray-600 max-w-3xl mx-auto">我们曾用这三招，把淘宝订单查询从12秒降到150毫秒</p>
            </div>

            <div class="grid md:grid-cols-3 gap-8 mb-16">
                <div class="card-hover bg-white p-6 rounded-xl border border-gray-200">
                    <div class="text-indigo-600 mb-4 text-3xl">
                        <i class="fas fa-arrows-alt-h"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3">游标分页黑科技</h3>
                    <p class="text-gray-600 mb-4">像翻书一样自然流畅（Twitter同款方案）</p>
                    <div class="mt-auto">
                        <span class="inline-block px-3 py-1 bg-indigo-50 text-indigo-700 rounded-full text-xs font-medium">顺序翻页</span>
                        <span class="inline-block px-3 py-1 bg-indigo-50 text-indigo-700 rounded-full text-xs font-medium ml-2">高性能</span>
                    </div>
                </div>
                <div class="card-hover bg-white p-6 rounded-xl border border-gray-200">
                    <div class="text-indigo-600 mb-4 text-3xl">
                        <i class="fas fa-random"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3">延迟关联骚操作</h3>
                    <p class="text-gray-600 mb-4">让MySQL先"瘦身"再干活（性能提升40倍）</p>
                    <div class="mt-auto">
                        <span class="inline-block px-3 py-1 bg-indigo-50 text-indigo-700 rounded-full text-xs font-medium">覆盖索引</span>
                        <span class="inline-block px-3 py-1 bg-indigo-50 text-indigo-700 rounded-full text-xs font-medium ml-2">减少回表</span>
                    </div>
                </div>
                <div class="card-hover bg-white p-6 rounded-xl border border-gray-200">
                    <div class="text-indigo-600 mb-4 text-3xl">
                        <i class="fas fa-handshake"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3">业务妥协的艺术</h3>
                    <p class="text-gray-600 mb-4">学淘宝限制最大页数（用户根本不在意第1000页）</p>
                    <div class="mt-auto">
                        <span class="inline-block px-3 py-1 bg-indigo-50 text-indigo-700 rounded-full text-xs font-medium">产品思维</span>
                        <span class="inline-block px-3 py-1 bg-indigo-50 text-indigo-700 rounded-full text-xs font-medium ml-2">用户体验</span>
                    </div>
                </div>
            </div>

            <div class="grid md:grid-cols-2 gap-12">
                <div>
                    <h3 class="text-2xl font-bold mb-4 flex items-center">
                        <i class="fas fa-arrows-alt-h mr-2 text-indigo-600"></i>
                        游标分页法
                    </h3>
                    <p class="text-gray-600 mb-4">适用于顺序翻页（不允许跳页）且排序字段唯一连续的场景</p>
                    
                    <div class="code-block mb-6">
                        <div class="code-header">
                            <span>SQL 示例</span>
                            <span class="code-copy"><i class="far fa-copy"></i> 复制</span>
                        </div>
                        <pre class="overflow-x-auto p-4 text-gray-200"><code>-- 原始分页（慢）
SELECT * FROM orders 
WHERE user_id=456 
ORDER BY created_at DESC 
LIMIT 100000, 20;

-- 游标分页（快）
SELECT * FROM orders 
WHERE user_id=456 
AND created_at < '2023-08-15 14:30:00' -- 上一页最后一条的时间
ORDER BY created_at DESC 
LIMIT 20;</code></pre>
                    </div>
                </div>
                <div>
                    <h3 class="text-2xl font-bold mb-4">性能对比</h3>
                    <div class="bg-white rounded-xl border border-gray-200 overflow-hidden">
                        <table class="min-w-full divide-y divide-gray-200 table-hover">
                            <thead class="bg-gray-50">
                                <tr>
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">分页方式</th>
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">第10页耗时</th>
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">第100页耗时</th>
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">第1000页耗时</th>
                                </tr>
                            </thead>
                            <tbody class="bg-white divide-y divide-gray-200">
                                <tr>
                                    <td class="px-6 py-4 whitespace-nowrap font-medium">传统分页</td>
                                    <td class="px-6 py-4 whitespace-nowrap">120ms</td>
                                    <td class="px-6 py-4 whitespace-nowrap">980ms</td>
                                    <td class="px-6 py-4 whitespace-nowrap">8.2s</td>
                                </tr>
                                <tr>
                                    <td class="px-6 py-4 whitespace-nowrap font-medium">游标分页</td>
                                    <td class="px-6 py-4 whitespace-nowrap">50ms</td>
                                    <td class="px-6 py-4 whitespace-nowrap">55ms</td>
                                    <td class="px-6 py-4 whitespace-nowrap">60ms</td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Data Visualization -->
    <section class="py-16 px-4 bg-white">
        <div class="max-w-5xl mx-auto">
            <div class="text-center mb-12">
                <h2 class="text-3xl font-bold mb-4">优化方案可视化对比</h2>
                <p class="text-gray-600 max-w-3xl mx-auto">不同数据量级下各方案的适用场景分析</p>
            </div>
            
            <div class="mermaid">
                graph TD
                    A[深分页优化方案选择] --> B{数据量级}
                    B -->|1万-100万| C[延迟关联]
                    B -->|100万-1000万| D[游标分页]
                    B -->|1000万+| E[搜索引擎]
                    
                    C --> F[利用覆盖索引减少回表]
                    D --> G[基于游标避免偏移量]
                    E --> H[Elasticsearch/Solr]
                    
                    style A fill:#f0f9ff,stroke:#2563eb
                    style B fill:#f0fdf4,stroke:#16a34a
            </div>
        </div>
    </section>

    <!-- Footer -->
    <footer class="bg-gray-900 text-gray-300 py-12 px-4">
        <div class="max-w-5xl mx-auto">
            <div class="text-center">
                <h3 class="text-xl font-bold text-white mb-2">Java技术小馆</h3>
                <p class="mb-6">专业的Java技术分享平台</p>
                <div class="flex justify-center space-x-4">
                    <a href="http://www.yuque.com/jtostring" class="text-indigo-400 hover:text-white transition-colors">
                        <i class="fas fa-globe mr-1"></i> 技术小馆地址
                    </a>
                </div>
            </div>
        </div>
    </footer>

    <script>
        // Initialize Mermaid
        mermaid.initialize({
            startOnLoad: true,
            theme: 'dark',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });

        // Add copy functionality to code blocks
        document.querySelectorAll('.code-copy').forEach(button => {
            button.addEventListener('click', () => {
                const codeBlock = button.closest('.code-block').querySelector('code');
                const range = document.createRange();
                range.selectNode(codeBlock);
                window.getSelection().removeAllRanges();
                window.getSelection().addRange(range);
                document.execCommand('copy');
                window.getSelection().removeAllRanges();
                
                const originalText = button.innerHTML;
                button.innerHTML = '<i class="fas fa-check"></i> 已复制';
                setTimeout(() => {
                    button.innerHTML = originalText;
                }, 2000);
            });
        });
    </script>
</body>
</html>
```